#include "expression_animate.h"
#include "expression_tree.h"
#include "animation.h"
#include "skeleton.h"
#include "model.h"

using namespace krryn::animation;

expression_animate::expression_animate(expression_tree *a_Tree, const std::string &a_Animation) 
	: expression(0), m_Tree(a_Tree), m_Animation(a_Tree->get_model().get_animation(a_Animation)) {}

void expression_animate::blend(float a_DT, skeleton *a_Result){
	m_Animation->update(a_DT);
	skeleton::interpolate(
		a_Result, 
		m_Animation->get_current(), 
		m_Animation->get_next(), 
		m_Animation->get_interpolation_factor()
	);
}